using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
   public class tbdulichBUS
    {
        public static tbdulichcollection Get(string where,
          int pageindex,
          int pagesize,
          string orderby,
          string orderdirection,
          out int total)
        {
            tbdulichDAL dulichDAL = new tbdulichDAL();
            return dulichDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbdulichcollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbdulichDAL dulichDAL = new tbdulichDAL();
            return dulichDAL.Get(cri.Criter, 0, 0, dulichcolumns.masanpham.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbdulich GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, dulichcolumns.masanpham.ToString(), Condition.EQUAL, iD);
            tbdulichDAL dulichDAL = new tbdulichDAL();
            tbdulichcollection dulichcollection = dulichDAL.Get(cri.Criter,
                     0, 0, dulichcolumns.masanpham.ToString(), OrderDirection.ASC.ToString(), out total);
            if (dulichcollection.Count > 0)
                return dulichcollection[0];
            return null;
        }
    }
}
